package com.kingdee.eas.custom.hr.applyinform.client;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.common.PersonUtil;
import com.kingdee.eas.custom.hr.applyinform.AddrChangeApplyEntryInfo;
import com.kingdee.eas.hr.base.client.HRBillEditUIBiz;
import com.kingdee.eas.hr.base.client.IHRF7CommonRegister;

public class AddrChangeApplyEditUIBiz extends HRBillEditUIBiz {

	private String[] cols = null;

	@Override
	protected IObjectValue createNewDetailData(PersonInfo p) {
		AddrChangeApplyEntryInfo info = new AddrChangeApplyEntryInfo();
		PersonInfo person = null;
		try {
			person = PersonUtil.getPersonInfo(new ObjectUuidPK(p.getId()), "*",
					"dept.*", "wed.*", "cummutingCode.*");
		} catch (Exception e) {
			this.handUIException(e);
		}
		info.setPerson(person);
		info.setNumber(person.getNumber());
		info.setName(person.getName());
		if (person.getDept() != null) {
			info.setAdminOrg(person.getDept());
		}

		info.setGender(person.getGender());
		info.setBirthday(person.getBirthday());
		info.setWed(person.getWed());
		info.setHjAddress(person.getHjAddress());

		if (person.getCummutingCode() != null) {
			info.setCommutingCode(person.getCummutingCode());
		}

		info.setAddress(person.getAddressTX());

		return info;
	}

	@Override
	protected boolean isAddPersonByF7() {
		return true;
	}

	@Override
	public void registerContextChangeF7(IHRF7CommonRegister register) {
		super.registerContextChangeF7(register);
		register
				.registerAdminByOrgRangePromptBox(((AddrChangeApplyEditUI) this.ctx
						.getUI()).prmtAdminOrg);
	}

	@Override
	protected void initEditor() throws Exception {

	}

	@Override
	public String[] getNotNullColumn() {
		return new String[] { "workStatus", "domicileType"};
	}

	@Override
	protected boolean isNeedSetLockColumnColor() {
		return true;
	}

	@Override
	protected boolean isNeedSetNotNullColumnColor() {
		return true;
	}
}
